{% extends ../base.html %}

{% block head %}

<style type="text/css">
    .fs-dir {
        
    }

    .fs-file {

    }
    table td {
        border: none;
    }
</style>

{% end %}

{% block body %}

<div>
    <form action="/fs_upload" enctype="multipart/form-data" method="POST" style="padding-top:20px;">
        <input name="dirname" style="display:none;" value="{{current_path}}"/>
        <input type="file" name="file"/>
        <button>上传</button>
    </form>
    
    {% if is_stared(current_path) %}
        <a href="/system/star?op=cancel&path={{current_path}}">取消收藏</a>
    {% else %}
        <a href="/system/star?path={{current_path}}">收藏</a>
    {% end %}
    
    <a href="/code/analyze?path={{current_path}}">分析</a>
    <a href="/fs_preview?path={{current_path}}">预览</a>
</div>

<hr/>

<div>

<div style="background: lightgreen;">
<a href="/fs-{{home}}">Home</a> /
{% for _path in fspathlist %}
    <a href="/fs-{{_path}}">{{os.path.basename(_path) }}</a> / 
{% end %}
</div>

<div class="col-md-12">

<!-- <li style="padding-top:6px;"><a href="/fs/{{parent_path}}/">上一级目录</a></li> -->

<table class="col-md-12">
{% for filename in filelist %}
    <tr>
        {% set filepath = current_path + filename %}
        <td>
        <!-- <div class="col-md-12" style="padding-top: 6px;"> -->
        {% if os.path.isdir(filepath) %}
            {% set filepath = filepath + "/" %}
            <img src="/static/img/folder.gif"/>
            <a href="/fs-{{filepath}}" class="fs-dir">{{filename}}</a>
        {% else %}
            <a href="/fs-{{filepath}}" class="fs-file">{{filename}}</a>
            
        {% end %}
        </td>

        <td>
            {{get_file_size(filepath)}}
        </td>

        <td>
            {% if filepath.endswith((".md", ".csv")) %}
                <a href="/wiki/{{filepath}}">[编辑]</a>
            {% end %}
        </td>
{% end %}
</table>

<!-- </div> -->

<hr/>

</div>

{% end %}